﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;


using System.ComponentModel;
using System.Drawing;
using System.IO;


namespace WpfPreviewerDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            OpenFileDialog od = new OpenFileDialog();
            DialogResult res = od.ShowDialog();
            if (res == System.Windows.Forms.DialogResult.OK)
            {
                //lblFileName.Text = System.IO.Path.GetFileName(od.FileName);
                previewControl.FileName = od.FileName;

                //imgExtension.Source = previewControl.ImageSource;
            }
        }
    }
}
///
///  Note--You can also use the (static) IconFromFileName method without using an instance of the control:
///  
///     imgExtension.Source = WpfDocumentPreviewer.PreviewerControl.IconFromFileName(od.FileName);
///    
